from flask import Flask, render_template, request, redirect, url_for, jsonify
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from models import db
from views import index_blu

app = Flask(__name__)
app.config.from_pyfile("config.ini")

# 注册蓝图
app.register_blueprint(index_blu)


db.init_app(app)

# 添加数据库迁移等工具
manager = Manager(app)
# 生成migrate对象 用来数据库迁移
migrate = Migrate(app, db)
# 添加db命令
manager.add_command('db', MigrateCommand)


if __name__ == '__main__':
    manager.run()
